<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta name="Content-Type" content="text/html; charset=UTF-8" />
<title>Documentation by YARD 0.5.3</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '';
  if (relpath != '') relpath += '/';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>

  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html" title="Index">Index</a> &raquo; 
    <span class="title">File: README</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  <a id="class_list_link" href="#">Class List</a>
  <a id="method_list_link" href="#">Method List</a>
  <a id ="file_list_link" href="#">File List</a>
</div>

      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><div id='filecontents'><h1>Lazyeval</h1>

<p>Homepage: <a href="http://github.com/vitaly/lazyeval/">http://github.com/vitaly/lazyeval/</a></p>

<p>This GEM allows to call methods lazily. The actual work will not be performed
until the result is used. There's no promise/force semantics, just a single
call (or block) is stored and executed the first time the (lazy) result is
accessed.</p>

<h2>USAGE</h2>

<h3>simple lazy call</h3>

<pre class="code"><span class='user identifier id'>user</span> <span class='assign token'>=</span> <span class='User constant id'>User</span><span class='dot token'>.</span><span class='lazy identifier id'>lazy</span><span class='dot token'>.</span><span class='find identifier id'>find</span><span class='lparen token'>(</span><span class='symbol val'>:first</span><span class='rparen token'>)</span> <span class='comment val'># will not access a db</span>
<span class='puts identifier id'>puts</span> <span class='user identifier id'>user</span><span class='dot token'>.</span><span class='name identifier id'>name</span> <span class='comment val'># this will actually perform the find and then get the name from</span>
               <span class='comment val'># the result</span>
</pre>

<h3>example for a lazy block</h3>

<pre class="code"><span class='user_name identifier id'>user_name</span> <span class='assign token'>=</span> <span class='User constant id'>User</span><span class='dot token'>.</span><span class='lazy identifier id'>lazy</span> <span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='user identifier id'>user</span><span class='bitor op'>|</span> <span class='user identifier id'>user</span><span class='dot token'>.</span><span class='find identifier id'>find</span><span class='lparen token'>(</span><span class='symbol val'>:first</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='user_name identifier id'>user_name</span> <span class='rbrace token'>}</span> <span class='comment val'># no db access</span>
<span class='puts identifier id'>puts</span> <span class='user_name identifier id'>user_name</span> <span class='comment val'># db will be accessed here</span>
</pre>

<h2>Note on Patches/Pull Requests</h2>

<ul>
<li>Fork the project.</li>
<li>Make your feature addition or bug fix.</li>
<li>Add tests for it. This is important so I don't break it in a future version
unintentionally.</li>
<li>Commit, do not mess with rakefile, version, or history.
(if you want to have your own version, that is fine but bump version in a
commit by itself I can ignore when I pull)</li>
<li>Send me a pull request. Bonus points for topic branches.</li>
</ul>

<h2>Copyright</h2>

<p>Copyright (c) 2010 Vitaly Kushner. See LICENSE for details.</p></div></div>
    
    <div id="footer">
  Generated on Tue May 11 16:34:44 2010 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
  0.5.3 (ruby-1.8.6).
</div>

  </body>
</html>